#pragma once 
#include <stdio.h>
#include <stdlib.h>
#include <sprng.h>

#include "../qmc.h"
#include "../WalkerGroup.h"
#include "../kernels.h"
#include "../GridException.h"

#define GRID_SPACING 7.0

class WalkerGroupCPU : public WalkerGroup
{
  public:
    void compute(cl_event* event);
    void writeToDisk(const char* filename);
    void getX(float* output);
    void getY(float* output);
    void getZ(float* output);
    WalkerGroupCPU(WalkerGroup* initial, 
                   unsigned int numWalkers,
                   unsigned int walkersStart);
    WalkerGroupCPU(unsigned int xDim,
                   unsigned int yDim,
                   unsigned int zDim);
    WalkerGroupCPU(const char* filename);
    ~WalkerGroupCPU();
    double getEnergy();
  protected:
    void allocate(unsigned int numParticles, unsigned int numWalkers);
    void initialize();
    void perturb();
    WalkerGroupCPU();
    int** mRandomGen;
    unsigned int* mCurBuffer;
    float* mX[2];
    float* mY[2];
    float* mZ[2];
    float* mWaveFunction[2];
    float* mPotential[2];
    float* mKinetic[2];
    float* mQForceX;
    float* mQForceY;
    float* mQForceZ;
    double* mTotalKinetic;
    double* mTotalPotential;
};
